]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
animationUtils: Allow marking animations as required
authorAlessandro Bono <alessandro.bono369@gmail.com>
Fri, 20 Oct 2023 20:00:40 +0000 (22:00 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 6 Sep 2024 13:01:39 +0000 (13:01 +0000)
There are cases when we want to mark an animation as required. For
example, we want the "Locate Pointer" animation to work even when
the animation is marked as disabled. Take this into account when
adjusting the animation time.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2986>

js/misc/animationUtils.js

index a7a0ea8b0b37d7aa788bc3ea930f0591dcc19f12..cf6889609980d402ec4590cfaa0b745afded95c6 100644 (file)
@@ -13,14 +13,20 @@ const N_WIGGLES = 3;
  * adjustAnimationTime:
  *
  * @param {number} msecs - time in milliseconds
+ * @param {object} params - optional parameters
+ * @param {boolean=} params.animationRequired - whether to ignore the enable-animations setting
  *
  * Adjust `msecs` to account for St's enable-animations
  * and slow-down-factor settings
  */
-export function adjustAnimationTime(msecs) {
+export function adjustAnimationTime(msecs, params) {
+    params = Params.parse(params, {
+        animationRequired: false,
+    });
+
     const settings = St.Settings.get();
 
-    if (!settings.enable_animations)
+    if (!settings.enable_animations && !params.animationRequired)
         return 0;
     return settings.slow_down_factor * msecs;
 }